package com.ygl.log.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Date 2022/1/30 9:43
 * @Created yanggld
 * @Description
 */
@Slf4j
@RestController
public class LogController {

    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    @RequestMapping("applog")
    public String getLog(@RequestParam("param") String jsonStr) {
        log.info(jsonStr);
        //将数据写入Kafka
        kafkaTemplate.send("ods_base_log", jsonStr);
        return "success";
    }

}
